package.cpath = package.cpath .. ";../../libs/?.so;../libs/?.so;../build/?.so"
package.path = package.path .. ";../../lua_libs/?.lua"

local packetbase = require "libpacketbase"
local logger = require "logger"

print("this is test lua")

function OnInit(id)
    print("[lua] test OnInit id:"..id)

    local pack = packetbase:CreatePacket()

    pack:WriteBegin(100)
    pack:WriteInt16(200)
    pack:WriteEnd()

    local buff, size = pack:GetBuffer()
    local pack2 = packetbase:CreatePacket()
    pack2:Copy(buff, size)
    local val = pack2:ReadInt16()
    print("val:", val)
    logger.Info("val:%s", val)

end

function OnExit()
    print("[lua] test OnExit")
end